home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 40 / 040.d81 / math puzzle (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  7KB  |  226 lines

  1. 10 poke53280,.:poke53281,.:gosub6000
  2. 11 print"[147]"chr$(142)"             math puzzle"
  3. 12 print"          [154]by kevin neelands "
  4. 13 print"[156]   do you need instructions? (y/n)"
  5. 14 getr$:ifr$<>"y"andr$<>"n"then14
  6. 15 ifr$<>"y"then20
  7. 16 gosub700
  8. 17 print"[147]"chr$(142)"             math puzzle"
  9. 18 print"          [154]by kevin neelands "
  10. 20 dima(24),c(28,9):y=rnd(-t1)
  11. 21 m1$="your guess is correct  "
  12. 22 m2$="your guess is incorrect[146]"
  13. 23 m4$=" .. please no spaces .."
  14. 24 m5$=" ** incorrect letter **"
  15. 25 m6$=" ** incorrect(= or n)**"
  16. 26 m7$=" **    input error   **"
  17. 27 m8$="                       "
  18. 30 gosub200 :rem initialize
  19. 35 print"  "
  20. 40 gosub350 :rem display
  21. 50 gosub600 :rem check for finish
  22. 60 gosub400 :rem input
  23. 70 goto40   :rem do it again
  24. 200 rem initialize
  25. 201 print"[145]do you want two or three addends[153](2[153] or 3[153])"
  26. 202 gety$:ify$<>"2"andy$<>"3" then202
  27. 203 ym=val(y$)+3
  28. 205 print"[145][145][154]  how many digits do you wish? ([154]4 - [154]8)   "
  29. 206 getm$:ifm$<"4"orm$>"8" then 206
  30. 207 ifasc(m$)>56orasc(m$)<52thenprint"[145]";:goto205
  31. 209 m=val(m$):sc=0:e=0:print"[145][145][129]           *** working ***             "
  32. 210 forx=0to9:b(x)=x+65:a(x+10)=x+38:nextx
  33. 220 forx=9to0step-1:y=int(rnd(1)*x+0.5)
  34. 230 a(x)=b(y):b(y)=b(x):nextx
  35. 234 fory=0to9:forx= 1to10:c(x,y)=21:nextx:nexty
  36. 236 fory=0to9:forx=11to28:c(x,y)=20:nextx:nexty
  37. 238 fory=0to9:c(0,y)=10:nexty
  38. 239 fory=2toym:c(0,y)=28:nexty
  39. 240 a(20)=32:a(21)=asc("?"):a(22)=asc("*"):a(23)=asc("[215]"):c(20+m,2)=0:a(24)=43
  40. 250 forx=20+mto21step-1:c(x,3)=int(rnd(1)*10):c(x,4)=int(rnd(1)*10)
  41. 260 d=c(x,2)+c(x,3)+c(x,4)
  42. 265 ifym=6thenc(x,5)=int(rnd(1)*10):d=d+c(x,5)
  43. 266 ifd>19thenc(x-1,2)=2:c(x,ym)=d-20:nextx:goto294
  44. 270 ifd>9thenc(x-1,2)=1:c(x,ym)=d-10:nextx:goto294
  45. 280 c(x-1,2)=0:c(x,ym)=d:nextx
  46. 294 c(20,3)=20:c(20,ym-1)=24:c(20,ym)=c(20,2):c(20+m,2)=20
  47. 295 print"[145][145][156] would you like the expert level (y/n)"
  48. 296 getrg$:ifrg$=""then296
  49. 298 ifrg$="y"thenforx=20to28:c(x,2)=20:nextx
  50. 300 printchr$(147);" ":return
  51. 350 print"        [154]press return [154]alone to exit"
  52. 351 print"              math puzzle"
  53. 352 print" [154]          by kevin neelands
  54. 353 [153]"sys"  m3$
  55. 354 [153]" "
  56. 355 [153]"   contabcdefghij       scoresys";sc""
  57. 360 [129]y[178]0[164]9:d$[178]"cont"[170][196](y)[170]"open ": [129]x[178]1[164]c(0,y)
  58. 370 d$[178]d$[170][199](a(c(x,y))):[130]x:[153]d$
  59. 380 [130]y:[153]"          ":[142]
  60. 400 [143] input
  61. 410 [153]"forplease enter your guess print#:              ";:e[178]0
  62. 411 [129]x[178]1[164]14:[153][199](20);:[130]x
  63. 415 [141]8000:g$[178]a$:[153]"                               "
  64. 420 l$[178][200](g$,1):e$[178][202](g$,2,1):n$[178][201](g$,1)
  65. 425 [129]x[178]1[164][195](g$):[139][202](g$,x,1)[178]" "[167]m3$[178]m4$:[141]350:e[178]1
  66. 426 [130]x:[139]e[178]1[167]410
  67. 430 [139][198](l$)[177]74[176][198](l$)[179]65[167]m3$[178]m5$:[141]350:[137]410
  68. 440 [139]e$[179][177]"="[175]e$[179][177]"n"[167]m3$[178]m6$:[141]350:[137]410
  69. 450 [129]x[178]3[164][195](g$)
  70. 452 [139][198]([202](g$,x,1))[177]57[176][198]([202](g$,x,1))[179]48[167]m3$[178]m7$:[141]350:e[178]1
  71. 454 [130]x:[139]e[178]1[167]410
  72. 460 n[178][197](n$):l[178][198](l$)[171]64:m3$[178]m1$
  73. 470 [139](c(l,n)[178]22)[176](c(l,n)[178]23)[167]m3$[178]m8$:[137]541
  74. 480 [139](a(n)[178]l[170]64)[167]495
  75. 485 [139]e$[178]"n"[167]sc[178]sc[170]1:c(l,n)[178]22:[153][199](19):[153]"sys"m3$:[137]540
  76. 490 c(l,n)[178]22:[153][199](19):m3$[178]m2$:[153]"sys"m3$:[137]540
  77. 495 [139]e$[178]"="[167][153][199](19):[153]"sys"m1$:[137]500
  78. 496 [153][199](19):m3$[178]m2$:[153]"sys"m3$
  79. 500 [129]y[178]0[164]9:[139]c(l,y)[179][177]22[167][139]e$[178]"="[167]sc[178]sc[170]1
  80. 510 c(l,y)[178]22:[130]y
  81. 520 [129]x[178]1[164]10:[139]c(x,n)[179][177]22[167][139]e$[178]"="[167]sc[178]sc[170]1
  82. 530 c(x,n)[178]22:[130]x:c(l,n)[178]23
  83. 540 [139]a(n)[178]l[170]64[167]a(n)[178]n[170]48
  84. 541 [139][195](g$)[177]3[167]g$[178][200](g$,[195](g$)[171]1):n$[178][201](g$,1):[137]460
  85. 545 [142]
  86. 600 [143] check for alllthru
  87. 610 [129]x[178]21[164]20[170]m:[129]y[178]2[164]ym
  88. 620 [139]a(c(x,y))[177]57[167][142]
  89. 630 [130]y:[130]x
  90. 640 [129]x[178]1[164]10:[129]y[178]0[164]9
  91. 650 [139]c(x,y)[178]21[167]sc[178]sc[170]1
  92. 660 [130]y:[130]x
  93. 666 [141]350
  94. 670 [153]"clr   do you wish to play again? (y/n)  "
  95. 671 [161]a$:[139]a$[178]""[167]671
  96. 672 [139]a$[178]"n"[167]680
  97. 673 [139]a$[178]"y"[167]675
  98. 674 [137] 671
  99. 675 m3$[178]m8$:[137]30
  100. 680 [153]"on      do you wish to quit? (y/n)      "
  101. 681 [161]a$:[139]a$[178]"y"[167]690
  102. 682 [139]a$[178]"n"[167][153]"on";:[137]670
  103. 683 [137] 681
  104. 684 :
  105. 685 [143] is loadstar there? if so loadit
  106. 686 :
  107. 690 [159]15,8,15,"r0:hello connect=hello connect":[132]15,er:[160]15
  108. 691 [139]er[179][177]63 [167][153]"load":[128]
  109. 695 [147] "hello connect",8,1
  110. 696 :
  111. 697 :
  112. 698 :
  113. 699 :
  114. 700 in$[178]"loadinstructionscont"[170][199](13)
  115. 710 [153]in$"cont this program provides you with puzzles"
  116. 720 [153]"that consist of addition problems that"
  117. 725 [153]"have been coded by randomly substit-"
  118. 730 [153]"uting the digits with the letters a-j"
  119. 735 [153]"in a consistent manner. ":[153]"for example-":[153]" "
  120. 740 [153]"           0100      jgjj"
  121. 745 [153]"            1634 ->   gfch"
  122. 750 [153]"           +4552     +hiid"
  123. 755 [153]"           06786     jfabf"
  124. 760 [153]" ":[153]"is one possible puzzle."
  125. 762 [153]"you would be given the puzzle on the"
  126. 763 [153]"right and have to decode it to the"
  127. 764 [153]"problem on the left."
  128. 765 [153]"note that all 'carried digits' are"
  129. 766 [153]"shown (the 1's and 0's in the top row)"
  130. 770 [153]"press any key when ready to continue"
  131. 771 [161]a$:[139]a$[178]""[167]771
  132. 780 [153]in$"cont you can make guesses two ways:"
  133. 790 [153]"  aprint#)cont equal guesses, such as f=2 "
  134. 800 [153]"     (f is equal to 2)"
  135. 810 [153]"  bprint#)cont not equal guesses, such as an1"
  136. 820 [153]"     or cn1357, meaning a is not 1"
  137. 830 [153]"     and c is not 1,3,5 or 7,"
  138. 840 [153]"     respectively. n means not equal"
  139. 850 [153]"note that your guess should have no "
  140. 855 [153]"spaces and if you use a not equal guess"
  141. 860 [153]"you may guess that the letter is not"
  142. 870 [153]"equal to a series of numbers"
  143. 880 [153]"press any key when ready to continue"
  144. 881 [161]a$:[139]a$[178]""[167] 881
  145. 890 [153]in$"cont most of your guesses will probaly be"
  146. 900 [153]"of the not equal type, so to help you"
  147. 910 [153]"keep track of the possible values for"
  148. 920 [153]"each letter a 'possibility grid' will"
  149. 930 [153]"be shown on the screen. its columns "
  150. 940 [153]"will correspond to letters and its"
  151. 950 [153]"rows will correspond to numbers. the"
  152. 960 [153]"grid will be filled with these symbols:"
  153. 970 [153]" ?cont  question marks indicate that the"
  154. 980 [153]"    letter is unknown.  it may or "
  155. 990 [153]"    may not be equal to the
  156. 1000 print"    corresponding number."
  157. 1010 :
  158. 1020 print" *[154]  this means the letter on this"
  159. 1030 print"    column is not equal to the number"
  160. 1040 print"    on this row"
  161. 1050 print" [215][154]  this means this letter is equal to"
  162. 1060 print"    this number, and has been replaced"
  163. 1070 print"    by it in the problem"
  164. 1080 print" ":print"press any key when ready to continue"
  165. 1081 geta$:ifa$=""then1081
  166. 1090 printin$"are you a little confused? my advice"
  167. 1100 print"is to play a couple of practice rounds"
  168. 1110 print"and it will all make sense"
  169. 1120 print"when the game starts you will be given"
  170. 1130 print"choices as to the number of addends"
  171. 1140 print"to be added, the number of digits in"
  172. 1150 print"each addend, and whether or not you"
  173. 1160 print"want the expert level. if you choose"
  174. 1170 print"the expert level the carried digits "
  175. 1180 print"will not be shown and the puzzle will"
  176. 1190 print"be harder"
  177. 1191 print"you can also quit by pressing return"
  178. 1192 print"alone at the guess prompt."
  179. 1200 print"by the way-perfect score is 100."
  180. 1210 print"press any key when ready to continue"
  181. 1220 geta$:ifa$=""then1220
  182. 1222 print"[147]":return
  183. 6000 :
  184. 6010 print"[147]"
  185. 6020 print"           [158]L O A D S T A R"
  186. 6030 print"           [152][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]"
  187. 6040 print
  188. 6050 print"               [154]Presents"
  189. 6060 print
  190. 6070 print
  191. 6080 print"